//
//  CTFile.h
//  ConstellationTalk_0.1
//
//  Created by riley on 15/4/24.
//  Copyright (c) 2015年 riley chu. All rights reserved.
//

/*
 归档分为三个文件，Documents，Library，Temporary。
 Doc 主要存储用户信息，token，还有需要持久化的数据
 Lib 主要存储内容数据
 tmp 主要存储临时文件，生命周期与APP相同
 
 
 Doc 存储文件:      //token
                   user/token.text
                   user/version_visitor_token.text
 
                   //用户基本信息
                   user/userInfo.plist
                   user/userPhoneNumber.text
                   
                   //其他用户的临时数据
                   user/otherUserInfo.plist
 
                   //用户其他信息
                   user/userType.text            new:新用户（还未完成注册）  reged:老用户（已完成注册过）
                   user/userCreated.text         1: 注册    0:未注册
 
                   //版本信息
                   appVersion/appVersionInfo.plist
  
                   //开关(0:代表审核，未上线  1:代表已上线)
                   switch/switch.text
                   switch/version.text
 
 
 Lib 存储文件:       //首页
                   cacheData/homepage/hotspotList/(group_id).plist
                   cacheData/homepage/hotspotDetailList.plist
                   cacheData/homepage/subjectList/(group_id).plist
                   
                   //发现
                   cacheData/discovery/followList.plist
                   cacheData/discovery/userSuggestion.plist
 
                   //通知消息
                   cacheData/message/personalMesg/(uid).plist 如果未登录状态则不能存取数据
                   cacheData/message/officialMesg/(uid).plist 如果未登录状态则是:visitor.plist
                   cacheData/message/TemporaryMesg/(uid)_personal.plist   ((uid)_official.plist)如果未登录状态则是:(visitor_official.plist)
                   cacheData/message/switch/switch.text
 
                   //个人
                   cacheData/user/followUserList.plist
                   cacheData/user/fenceUserList.plist
                   cacheData/user/userPublishDetailList.plist
                   cacheData/user/userPublishDetailInfoList.plist
 
 
                   //发布，编辑
                   cacheData/publish/emojiList.plist
                   cacheData/publish/bubbleList.plist
                   //默认新浪分享
                   cacheData/publish/share/share.text
 
 
 
                   //其它（评论）
                   cacheData/other/commentList.plist
 
 
 
 
 tmp 存储文件:
 
 
 */



#import <Foundation/Foundation.h>

typedef enum {
    CTFileDocDocuments =1,
    CTFileDocLibrary,
    CTFileDocTemporary
}CTFileDoc;


@interface CTFile : NSObject



//归档数据

+(void)cacheFile:(NSString *)file
        fileName:(NSString *)name
         saveDoc:(CTFileDoc)docType
        savePath:(NSString *)path;
+(void)cacheDicFile:(NSMutableDictionary *)file
        fileName:(NSString *)name
         saveDoc:(CTFileDoc)docType
        savePath:(NSString *)path;
+(void)cacheArrFile:(NSMutableArray *)file
        fileName:(NSString *)name
         saveDoc:(CTFileDoc)docType
        savePath:(NSString *)path;

//读取数据
+(NSString *)getFile:(NSString *)name
       fromDoc:(CTFileDoc)docType
      fromPath:(NSString *)path;
+(NSMutableDictionary *)getDicFile:(NSString *)name
       fromDoc:(CTFileDoc)docType
      fromPath:(NSString *)path;
+(NSMutableArray *)getArrFile:(NSString *)name
       fromDoc:(CTFileDoc)docType
      fromPath:(NSString *)path;



//更新数据


//删除数据
+(void)removeFile:(NSString *)name
             fromDoc:(CTFileDoc)docType
            fromPath:(NSString *)path;



//文件是否存在
+(BOOL)isExistFile:(NSString *)name
               doc:(CTFileDoc)docType
              path:(NSString *)path;





@end
